package boot3.mapper;

import boot3.pojo.Teacher;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface TeacherMapper {
    //根据老师的姓名获取老师
    @Select("select * from teacher where teacher_name=#{teacher_name}")
    public List<Teacher> getTeacher(String teacher_name);
    //获取某学院的所有老师
    @Select("select * from teacher where college=#{college}")
    public List<Teacher> getTeachersByCollege(String college);
    //根据老师的ID获取指定的老师
    @Select("select * from teacher where teacher_id=#{teacher_id}")
    public Teacher getTeacherById(String teacher_id);
    //根据老师的ID修改某条老师的信息
    @Update("update teacher set ${item} = #{value} where teacher_id=#{teacher_id}")
    public Boolean updateTeacher(String teacher_id,String item, String value);
    //新加老师
    @Insert("insert teacher value(#{teacher_id},#{teacher_name},#{teacher_sex},#{college},#{department},#{courses}," +
            "#{research_exper},#{phone})")
    public Boolean insertTeacher(Teacher teacher);
    //根据老师Id删除指定的老师
    @Delete("delete from teacher where teacher_id=#{teacher_id}")
    public Boolean deleteTeacher(String teacher_id);
}
